package com.cn.qgx428.lazydiary.ui.activity

import android.graphics.Color
import android.support.v7.app.AppCompatActivity
import android.os.Bundle
import com.cn.qgx428.lazydiary.Presenter.BillPresenter
import com.cn.qgx428.lazydiary.R
import kotlinx.android.synthetic.main.activity_sync.*
import org.jetbrains.anko.toast

class SyncActivity : BaseActivity() {
    override fun initUI() {
        hindActionBar()
        setStatuBarColor(Color.BLACK)
    }


    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_sync)

        sync_title.setOnClickListener { finish() }
        sync_bill.setOnClickListener { syncBill() }
    }

    fun syncBill(){
        val loadDialog = getLoadingDialog()
        loadDialog.setText("同步中...")
        loadDialog.show()
        BillPresenter.syncUp {
            loadDialog.dismiss()
            toast("已同步")
            finish()
        }
    }
}
